﻿/*
 * ============ [ 废土 ] ============
 *
 * [ 维护者 ]  argoran@gmail.com
 * [  状态  ]  原型
 *
 * ============ [ 注释 ] ============
 *
 * 处理exit指令的类
 *
 * ==================================
 */

using System;

using LastLand.Data.Global;

namespace LastLand.Core.CmdInterpreter
{
    public class CCmdExit : ICommandInterpreter
    {
        public void ExecuteCommand(String _cmd, String _args)
        {
            CData.serverOn = false;

            if (CData.server != null && CData.server.isServerOn())
            {
                CData.connections.Clear();

                CData.server.Close();
                CData.server = null;

                CData.console.SendOutput("");
                CData.console.SendOutput("服务器关闭");
            }
            else
            {
                CData.console.SendOutput("");
                CData.console.SendOutput("服务器已经关闭");
            }
        }
    }
}
